Device Space
Device space defines the location and dimensions of a shape as displayed on a particular output device. The upper-left corner of the displayable area of a view device is at coordinate (0.0, 0.0) in device space. Unit distance between coordinates in device space represents one picture element, or pixel.The view device's mapping defines both its location in global space (as a translation factor) and its pixel size (as a scaling factor). For example, if your device is a 144 pixels-per-inch high-resolution monitor, QuickDraw GX converts global space to device space when drawing by scaling each global-space point by 2.0, which is 144/72. By default, if there is a single view device in a view group, the translation value in its mapping is 0, meaning that point (0.0, 0.0) in device space is also point (0.0, 0.0) in global space. The view device's clip is a (usually rectangular) shape representing the displayable area of the device.
As the final stage in drawing a shape, QuickDraw GX converts the shape from global space to device space. It modifies the shape's dimensions by applying first the mapping and then the clip of any view device object in the same view group whose clip overlaps the view port clip.
The example vase shape shown in the previous figures is drawn onto a single view device. The left side of Figure 7-18 shows the vase shape after the view device mapping has been applied to it. In this example, the view device mapping specifies no translation, but the pixel resolution is 144 ppi so it scales the shape by 2.0. The shape is now in device space, and its visible part is approximately 100 by 400 pixels in size (which is still about 0.7 by 2.8 inches).
Figure 7-18 Applying the view device's mapping and clip to a shape
The right side of Figure 7-18 shows the vase shape after the view device clip has been applied to it. The view device clip for the monitor represents its imaging area, exclusive of the menu bar. In this case, the view device clip cuts off part of the visible area of the view port, so the lower part of the vase shape (shaded gray in Figure 7-18) is not drawn on this device.
Figure 7-19 shows the example vase shape as actually displayed, after all clipping and coordinate conversions have been applied. The clipped and stretched vase shape is partially scrolled out of view in its window, and the lower part of the window is clipped by the bottom edge of the monitor.
Figure 7-19 The shape as finally displayed
It is seldom necessary to work in device space because QuickDraw GX performs this conversion for you. QuickDraw GX also handles modifications to the view device mappings to match the monitor configuration. For example, if you use the Monitors control panel to change the relative positions of monitors on a Macintosh system, QuickDraw GX handles the changes for you.